// lightclick.m
#import "lightclick.h"

@implementation lightclick

RCT_EXPORT_MODULE(lightclick);

RCT_EXPORT_METHOD(addEvent:(NSString*)type callback:(RCTResponseSenderBlock)callback) {
  if(@available(iOS 10.0,*)){
    dispatch_async(dispatch_get_main_queue(), ^{
      NSString *message = @"success";
      UIImpactFeedbackGenerator *generator = [[UIImpactFeedbackGenerator alloc] initWithStyle: [type isEqualToString:@"light"] ? UIImpactFeedbackStyleLight : [type isEqualToString:@"medium"] ? UIImpactFeedbackStyleMedium : UIImpactFeedbackStyleHeavy];
      [generator prepare];
      [generator impactOccurred];
      callback( [[NSArray alloc] initWithObjects:message, nil]);
    });
  }
}

@end
